﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using UIT.Controls;
using System.Xml;
using NAcl;

namespace UIT.Web.Renderers.Specials
{
	public static class AclRenderer
	{
		public static void RenderAcls(this IControl control, XmlWriter writer)
		{
			if (!string.IsNullOrEmpty(control.AclResource))
			{
				if (!AclManager.IsAllowed(control.AclResource, "Visible"))
					writer.WriteAttributeString("style", "display:none");
				if (!AclManager.IsAllowed(control.AclResource, "Enable"))
					writer.WriteAttributeString("disabled", "disabled");
			}
		}
	}
}
